<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<h:head><title>TravelDream</title>
	<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
</h:head> 
<body> 

	
	<h:outputStylesheet library="css" name="primefaces-style.css"/>

	<p:panel id="navigationPanel" header="Admin Console">
		<h:panelGrid id="p_grid_nav" columns="10" cellpadding="3">
			<h:link outcome="homePage" value="Admin Console"/>
			
			 <h:link outcome="createTravelPackage" value="new package" />  
			  
			  <h:link outcome="newFlight" value="new flight"/>
			  
			  <h:link outcome="newHotel" value="new hotel"/> 
			  
			  <h:link outcome="newExcursion" value="new excursion"/>
			  
			  <h:link outcome="showAllPackages" value="show all packages" /> 
			 
			  <h:link outcome="showAllHotels" value="show All Hotels"/> 
			   
			  <h:outputText value="show all flights" />
			   
			  <h:link outcome="showExcursion" value="show excursions"/> 
			  
			  <h:link outcome="manageCity" value="manage city"/>
			  
	 
			  <h:form>
				<p:commandButton id="logoutButtonFlight" value="logout" action="#{logout.logout()}"/>
			</h:form>
		</h:panelGrid>
	</p:panel>
	
	
<div id="result">
	<p:panel id="allFlightsPanel" header="All flights" rendered="#{!flights.edit}" styleClass="blue-header">
			<h:form id="allFlightsInTheSystemForm" >  
		    	<p:dataTable id="resultDataTableflights" var="FlightDTO" value="#{flights.result}">  
	
			       <p:column headerText="Id" filterBy="id" filterMatchMode="contains">  
			            <h:outputText value="#{FlightDTO.id}" />  
			       </p:column>  
			        
			     
			      <p:column headerText="ArrivalCity" filterBy="arrivalCity" filterMatchMode="contains">  
			            <h:outputText value="#{FlightDTO.arrivalCity}" />  
			        </p:column>  
			  
			      <p:column headerText="DepartureCity" filterBy="departureCity" filterMatchMode="contains">  
			            <h:outputText value="#{FlightDTO.departureCity}" />  
			        </p:column>  
			        
			 		 <p:column headerText="Data">  
			            <h:outputText value="#{FlightDTO.data}" />  
			        </p:column>
			        
			         <p:column headerText="Price (EUR)">  
			            <h:outputText value="#{FlightDTO.price}" />  
			        </p:column>
			        
			        <p:column headerText="IsActive" filterBy="active" filterMatchMode="contains">  
			            <h:outputText value="#{FlightDTO.active}" />  
			        </p:column>
			     
			       <p:column headerText="">  
			            <p:commandButton value="edit" action="#{flights.editFlight(FlightDTO)}"  ajax="false"/> 
			        </p:column>
			        
			         <p:column headerText="">  
			        <p:commandButton value="Delete" action="#{flights.delete(FlightDTO)}" ajax="false"/>
			        </p:column>
			        
			        <p:column headerText="">  
			        <p:commandButton value="Activate" action="#{flights.activate(FlightDTO)}" ajax="false" rendered="#{!FlightDTO.active}"/>
			         
			        <p:commandButton value="Disable" action="#{flights.disable(FlightDTO)}" ajax="false" rendered="#{FlightDTO.active}"/>
			        </p:column>     		  
    	</p:dataTable>  
	</h:form> 
	</p:panel> 
</div>


	<p:panel id="editFlight_p" header="Edit Flight" rendered="#{flights.edit}" styleClass="blue-header">
	<h:form id="editFlight_f">
        <h:panelGrid columns="3" cellpadding="5">  
            
            <h:outputText value="id " />  
            <h:outputText value="#{flights.selectedFlight.id} " />  
            <h:outputText value="" />  
              
            <h:outputText value="departureCity" />
				<p:selectOneMenu value="#{flights.selectedFlight.departureCity}"  panelStyle="width:150px" 
        		 effect="fade" var="p" style="width:160px"  filter="true" filterMatchMode="startsWith">
        		 <f:selectItem itemLabel="Select One" itemValue="" /> 
        		<f:selectItems value="#{cityBean.allCityList}" var="CityDTO" itemLabel="#{CityDTO.city}" itemValue="#{CityDTO.city}"/>
         		</p:selectOneMenu> 
         		<h:outputText value="#{flights.errorDepartureCity}" />
                               
			                   
            <h:outputText value="arrivalCity" />  
     		<p:selectOneMenu value="#{flights.selectedFlight.arrivalCity}"  panelStyle="width:150px" 
        		 effect="fade" var="q" style="width:160px"  filter="true" filterMatchMode="startsWith">
        		 <f:selectItem itemLabel="Select One" itemValue="" /> 
        		<f:selectItems value="#{cityBean.allCityList}" var="CityDTO" itemLabel="#{CityDTO.city}" itemValue="#{CityDTO.city}"/>
         		</p:selectOneMenu> 
         	<h:outputText value="#{flights.erroreArrivalCity}" />
         	
     		
     		<h:outputText value="Date" /> 
     		<p:calendar value="#{flights.selectedFlight.data}" pattern="MM/dd/yyyy HH:mm" />
     		<h:outputText value="#{flights.errorDate}" />
     		
     		
     		<h:outputText value="Price (EUR)" />  
     		<p:inputText value="#{flights.selectedFlight.price}"/>
     		<h:outputText value="#{flights.errorPrice}" />
			
			<p:commandButton id="save_b" value="save" action="#{flights.saveFlightEdit()}" rendered="#{flights.edit}" ajax="false"/>
        	<p:commandButton id="cancel_b" value="cancel" action="#{flights.cancel()}" rendered="#{flights.edit}" ajax="false"/>
        	
        </h:panelGrid>
         </h:form> 
         
	
        </p:panel> 
        
         <h:form>
        	
			
        	 <p:panel id="errorPanel" header="Error" rendered="#{flights.showError}" styleClass="error-header">
				<h:outputText value="#{flights.errorModification   }" />
				<h:outputText value="#{flights.errorDeleteString   }" />
				<p:commandButton value="ok" action="#{flights.cancel()}" ajax="false"/>
			</p:panel>
         </h:form>
        


</body> 
</html>